const exp = require('express');
const data = require('./data/lol.json');

const app = exp()

app.use(exp.static(__dirname + '/public'))

app.get('/list', (req, res) => {

    // 显示列表

    let str = data.heros.map(item => `  <li class="item">
            <img src="${item.avatar}" />
            <p>${item.name}</p>
        </li>`).join('');
    res.send(`<head>
        <link rel="stylesheet" href="./css/app.css" />
    </head><ul class="hero-list">${str}</ul>`)
    
})



app.listen(80)